<template>
  <view class="register-page">
    <view class="register-container">
      <text class="title">注册</text>
      <view class="input-group">
        <input 
          type="text" 
          placeholder="请输入用户名" 
          v-model="username" 
          class="input"
        >
        <input 
          type="password" 
          placeholder="请输入密码" 
          v-model="password" 
          class="input"
        >
        <input 
          type="password" 
          placeholder="请确认密码" 
          v-model="confirmPassword" 
          class="input"
        >
      </view>
      <button class="register-btn" @click="handleRegister">注册</button>
      <navigator url="/pages/login/login" class="to-login">已有账号？前往登录</navigator>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      username: '',
      password: '',
      confirmPassword: ''
    };
  },
  methods: {
    handleRegister() {
      if (this.password !== this.confirmPassword) {
        uni.showToast({
          title: '两次密码不一致',
          icon: 'none'
        });
        return;
      }
      uni.showToast({
        title: '注册成功',
        icon: 'success'
      });
    }
  }
};
</script>

<style scoped>
.register-page {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f5f5f5;
}
.register-container {
  width: 80%;
  background-color: #fff;
  padding: 40rpx;
  border-radius: 12rpx;
  box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
}
.title {
  display: block;
  text-align: center;
  font-size: 36rpx;
  font-weight: bold;
  margin-bottom: 40rpx;
  color: #333;
}
.input-group {
  margin-bottom: 30rpx;
}
.input {
  width: 100%;
  height: 80rpx;
  line-height: 80rpx;
  border: 1rpx solid #ddd;
  border-radius: 6rpx;
  padding: 0 20rpx;
  margin-bottom: 20rpx;
  box-sizing: border-box;
}
.register-btn {
  width: 100%;
  height: 80rpx;
  line-height: 80rpx;
  background-color: #007AFF;
  color: #fff;
  border-radius: 6rpx;
  font-size: 32rpx;
}
.to-login {
  display: block;
  text-align: center;
  margin-top: 20rpx;
  color: #007AFF;
  font-size: 28rpx;
}
</style>